<template>
  <div class="public-sub-nav">
    <ul class="sub-nav-list">
      <li v-for="(item, index) in navList" :key="index" :class="{'activate': item.activate}">
        <router-link :to="item.href">{{item.text}}</router-link>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    navList: {
      type: Array
    }
  }
}
</script>

<style lang="less" scoped>
.public-sub-nav {
  .sub-nav-list {
    overflow: hidden;
    margin-bottom: 20px;
    li {
      line-height: 30px;
      font-size: 14px;
      float: left;
      background: #e9e9e9;
      position: relative;
      margin-left: 10px;
      &:after {
        content: '';
        width: 0;
        height: 0;
        border-top: 15px solid transparent;
        border-left: 11px solid #e9e9e9;
        border-bottom: 15px solid transparent;
        background-color: transparent;
        position: absolute;
        position: absolute;
        right: -11px;
        top: 0;
      }
      &:before {
        content: '';
        width: 0;
        height: 0;
        border-top: 15px solid transparent;
        border-left: 11px solid #f5f5f5;
        border-bottom: 15px solid transparent;
        background-color: transparent;
        position: absolute;
        position: absolute;
        left: 0;
        top: 0;
        z-index: 2
      }
      &:first-child {
        margin-left: 0;
        &:before {
          border-top: 0;
          border-left: 0;
          border-bottom: 0;
        }
      }
    }
    a {
      line-height: 30px;
      padding: 0 10px 0 20px;
      color: #999;
      &:hover {
        color: #ffa93a;
      }
    }
    .activate {
      background: #2cd0ff;
      a {
        color: #fff;
      }
      &:after {
        content: '';
        width: 0;
        height: 0;
        border-top: 15px solid transparent;
        border-left: 11px solid #2cd0ff;
        border-bottom: 15px solid transparent;
        background-color: transparent;
        position: absolute;
        position: absolute;
        right: -11px;
        top: 0;
      }
    }
  }
}
</style>


